<?php
if (!class_exists('PropelTemplate')) {
	/**
	 *  Utility dao class for Propel ORM
	 *	@author Alecsandru Gabriel DINU
	 *  @since Jun 20, 2008
	 */
	class PropelTemplate implements Singleton_Interface {

		private static $theInstance;

		private function __construct() {
			$this->load();
		}

		public static function getInstance() {
			if (!self::$theInstance) {
				self::$theInstance = new PropelTemplate();
			}
			return self::$theInstance;
		}

		public function load() {
			ini_set('ze1_compatibility_mode', 'Off');
			ini_set('magic_quotes_gpc', 'Off');
			ini_set('magic_quotes_sybase', 'Off');

			require_once("lib/propel/runtime/classes/propel/Propel.php");
			if (file_exists("src/main/resources/propel-config.php")) {
				Propel::init("src/main/resources/propel-config.php");
			}	
			
		}

		/**
		 * Override clone method to throw exception
		 * @access public
		 * @return void
		 * @throws Exception
		 */
		public function __clone() {
			throw new Exception('You cannot clone singleton object');
		}

	}
}
?>